package syn;

import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

public class SynTest {
    private static AtomicInteger j = new AtomicInteger(0);

    public void intc(){
        long start = System.currentTimeMillis();

            for (int i=0;i<100000000;++i){
                j.incrementAndGet();
            }

        System.out.println(System.currentTimeMillis()-start);
    }
    public int getJ(){
        return j.get();
    }
}
class SycMain{
    public static void main(String[] args) throws InterruptedException {
        SynTest synTest = new SynTest();
        Thread thread1 = new Thread(()->synTest.intc());
        Thread thread2 = new Thread(()->synTest.intc());
        thread1.start();
        thread2.start();
        thread1.join();
        thread2.join();
        System.out.println(synTest.getJ());
    }
}
